package vista;
import java.awt.BorderLayout;

import java.awt.HeadlessException;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;


/**
 * This code was edited or generated using CloudGarden's Jigloo
 * SWT/Swing GUI Builder, which is free for non-commercial
 * use. If Jigloo is being used commercially (ie, by a corporation,
 * company or business for any purpose whatever) then you
 * should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details.
 * Use of Jigloo implies acceptance of these licensing terms.
 * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
 * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
 * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class VentanaArbitro extends JFrame {

	private JTextField txtCedula;
	private JTextField txtNombre;
	private JTextField txtApellido;
	private JTextField txtFechaNac;
	private JTextField txtJuegArbit;
	private JLabel lblTitulo, lblCedula, lblNombre, lblApellido, lblFechaNac, lblJuegArbit;
	private JButton btnNuevo, btnGuardar, btnCancelar;
	private JPanel panArbitro;

	public VentanaArbitro() {
		super();
		Proceso();
	}

	public void Proceso(){

		try{
			panArbitro = new JPanel();
			getContentPane().add(panArbitro, BorderLayout.CENTER);   //Agregar nuevo panel
			panArbitro.setBounds(15, 15, 600, 900);   //Tamaño del Panel, (coordenada X, coordenada Y, ancho width, altura height
			panArbitro.setBackground(new java.awt.Color(130,150,200));  //Color fondo
			panArbitro.setLayout(null);   //El panel no acomodara los elementos por si solo asi que el organizador Layout sera nulo
			panArbitro.setPreferredSize(new java.awt.Dimension(408, 320));
			//panArbitro.setPreferredSize(new java.awt.Dimension(544, 346));

			lblTitulo = new JLabel();
			panArbitro.add(lblTitulo);
			lblTitulo.setText("ARBITRO");
			lblTitulo.setBounds(150, 20, 137, 36);
			lblTitulo.setBackground(new java.awt.Color(255,255,255));
			lblTitulo.setFont(new java.awt.Font("Comic Sans",1,26));

			lblCedula = new JLabel();
			panArbitro.add(lblCedula);
			lblCedula.setText("Cedula:");
			lblCedula.setBounds(25, 71, 67, 23);
			lblCedula.setFont(new java.awt.Font("Comic Sans",1,16));

			txtCedula = new JTextField();
			panArbitro.add(txtCedula);
			txtCedula.setBounds(104, 75, 120, 22);
			txtCedula.setBackground(new java.awt.Color(255,255,255));

			lblNombre = new JLabel();
			panArbitro.add(lblNombre);
			lblNombre.setText("Nombre:");
			lblNombre.setBounds(25, 108, 79, 25);
			lblNombre.setFont(new java.awt.Font("Comic Sans",1,16));

			txtNombre = new JTextField();
			panArbitro.add(txtNombre);
			txtNombre.setBounds(104, 110, 220, 22);
			txtNombre.setBackground(new java.awt.Color(255,255,255));

			lblApellido = new JLabel();
			panArbitro.add(lblApellido);
			lblApellido.setText("Apellido:");
			lblApellido.setBounds(25, 145, 79, 21);
			lblApellido.setFont(new java.awt.Font("Comic Sans",1,16));

			txtApellido = new JTextField();
			panArbitro.add(txtApellido);
			txtApellido.setBounds(104, 145, 220, 22);
			txtApellido.setBackground(new java.awt.Color(255,255,255));

			lblFechaNac = new JLabel();
			panArbitro.add(lblFechaNac);
			lblFechaNac.setText("Fecha de Nacimiento:");
			lblFechaNac.setBounds(25, 181, 195, 20);
			lblFechaNac.setFont(new java.awt.Font("Comic Sans",1,16));

			txtFechaNac = new JTextField();
			panArbitro.add(txtFechaNac);
			txtFechaNac.setBounds(220, 180, 60, 22);
			txtFechaNac.setBackground(new java.awt.Color(255,255,255));

			lblJuegArbit = new JLabel();
			panArbitro.add(lblJuegArbit);
			lblJuegArbit.setText("Juegos Arbitrados:");
			lblJuegArbit.setBounds(25, 215, 166, 20);
			lblJuegArbit.setFont(new java.awt.Font("Comic Sans",1,16));

			txtJuegArbit = new JTextField();
			panArbitro.add(txtJuegArbit);
			txtJuegArbit.setEnabled(false);
			txtJuegArbit.setBounds(200, 215, 30, 22);
			txtJuegArbit.setBackground(new java.awt.Color(255,255,255));

			btnNuevo = new JButton();
			panArbitro.add(btnNuevo);
			btnNuevo.setText("NUEVO");
			btnNuevo.setBounds(25, 269, 83, 30);
			btnNuevo.setBackground(new java.awt.Color(0,170,255));
			btnNuevo.setEnabled(true);

			btnGuardar = new JButton();
			panArbitro.add(btnGuardar);
			btnGuardar.setText("GUARDAR");
			btnGuardar.setBounds(127, 269, 115, 30);
			btnGuardar.setBackground(new java.awt.Color(0,170,255));
			btnGuardar.setEnabled(true);

			btnCancelar = new JButton();
			panArbitro.add(btnCancelar);
			btnCancelar.setText("CANCELAR");
			btnCancelar.setBounds(264, 269, 124, 30);
			btnCancelar.setBackground(new java.awt.Color(0,170,255));
			btnCancelar.setEnabled(true);

			this.setSize(426, 356);
		}catch(Exception e) {
			e.printStackTrace();

		}

	}

	public void agregarListener(ActionListener accion) {
		btnNuevo.addActionListener(accion);
		btnGuardar.addActionListener(accion);
		btnCancelar.addActionListener(accion);
	}   

	public void setTxtJuegArbit(String jueg) {
		this.txtJuegArbit.setText(jueg);
	}

	public String getTxtCedula() {
		return txtCedula.getText();
	}

	public String getTxtNombre() {
		return txtNombre.getText();
	}

	public String getTxtApellido() {
		return txtApellido.getText();
	}

	public String getTxtFechaNac() {
		return txtFechaNac.getText();
	}

	public String getTxtJuegArbit() {
		return txtJuegArbit.getText();
	}

	public void mostrarMensaje(String mensaje){
		JOptionPane.showMessageDialog(this, mensaje);
	}

	public void Limpiar(){
		txtCedula.setText("");
		txtNombre.setText("");
		txtApellido.setText("");
		txtFechaNac.setText("");
		txtJuegArbit.setText("");
	}


}
